Browsing/Controlling Raspberry Pi Over Internet
Here's one reason why SFTP is a better option than Samba. You can access your Pi from anywhere in the world! (Suck it, Samba!) To do this is quite straightforward. You only need to know how to setup port forwarding on your router. DISCLAIMER: PORT FORWARDING CREATES A BACKDOOR TO YOUR HOME NETWORK. KEEP YOUR BACKDOOR LOCKED BY CHOOSING STRONG PASSWORDS. DON'T KEEP THE DEFAULT PASSWORD IF YOU CHOOSE TO FOLLOW THIS TUTORIAL! To change your user password, issue sudo passwd username where "username" is your current user. To change your Samba password, issue sudo smbpasswd -a username where "username" is your current user. 'Port Forwarding' Port forwarding is a feature of most (if not all) routers that lets a service on your computer bypass firewalls and be accessed from anywhere over the internet. All services have their own port number. As you may have figured out, the port number for SSH on the Pi is 22. All routers will be different, but you can generally setup port forwarding on your router's home page. I'll demonstrate how to do it with my Verizon FiOS router. Go to your router's homepage in an internet browser and login. For my Verizon FiOS router, the address is 192.168.1.1 and the default login information is User Name: "admin" and Password: "password". This will take you to the router's homepage. At the top of the screen, click "FIREWALL". It will give you a warning, but just click "Yes" to advance. Next click on "Port Forwarding" in the left-hand menu bar. This will take you to the port forwarding setup screen, where you can create a new port forwarding rule. For the FiOS router, there is a drop-down list with all of the IP addresses on the local network. Select the IP address for your Pi. There are a lot of default applications that are common to forward, but we want to create a custom rule, so select "Custom Ports". Then select "Both" TCP and UDP, and enter the port number of 22. (Every service on the Pi has a unique port number. For SSH it's 22, as you may have guessed.) Finally, click "Add". Your port is now forwarded! 'Know Your External IP Address' Once you've setup port forwarding, you can now access your files over the internet. First, you'll need to know the external IP address of your router. This is how your local network is addresses on the internet. For my Verizon FiOS router, this is shown on the router's home page. You can also just google "get external ip address" (from a computer on your local network), and Google magic will show you your external IP address. Now you can use a SFTP client (like Filezilla) or an SSH client (like PuTTY), just by just using your external IP address and your forwarded SSH port. Descriptions of how to use Filezilla and PuTTY are also on the MTRTech Wikia; just follow the links. 'Access SFTP On Android' To test your external SFTP access, you have to be on a device that is not on your local network. If you have an Android phone, you can disable your WiFi. Go to the Google Play Store and install the Turbo FTP client & SFTP client. Run Turbo Client. The first time you open it, you'll need to "Create a new account". Now enter the connection information for your Pi: Connection name (whatever you'd like), Username (pi, most likely), Password (raspberry, most likely), Host (the external IP address of your local network), Port (22). Then click the save (disk) icon at the top of the app. This will take you back to your list of connections, which should now show your Pi connection. Click on your connection, and you'll be taken to a list of folders on your Pi. You're in! 'Access Raspberry Pi Command Line From Android' You can also use an Android app like ConnectBot to access your Pi's command line, just like using PuTTY.. On ConnectBot, you'll just login using the login "username@XXX.XXX.XXX.XXX:port", where "username" is your Pi's username, "XXX.XXX.XXX.XXX" is your external IP address, and "port" is your forwarded port. (22 is the default for SSH on the Pi.) This will take you to a command line prompt, just like PuTTY.